home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
MACUNZIP
/
MACUNZIP._RE
< prev
next >
Wrap
Text File
|
1991-08-18
|
7KB
|
155 lines
------------------------------------------------------------------------
MacUnZip: ZIP File Extraction Utility for the Macintosh
John Eng July 1991
(GEnie Mail Address: J.ENG)
------------------------------------------------------------------------
------------
INTRODUCTION
------------
MacUnZip unpacks ".ZIP" files, a packing/archiving format that is used on IBM
compatibles. On the Macintosh, this program may be used to unpack text files
and certain standard data (e.g., MIDI) files created on an IBM compatible. The
source code for MacUnZip is a modification of a modification: it is based on
UNZIP Version 2.0.1 for the IBM by Samuel H. Smith, which was modified by George
M. Sipe for "portability" to UNIX, Microsoft C for the IBM, and other machines.
Accompanying this document should be the following files:
File Description
UNZIP.C Smith/Sipe source code as modified by J. Eng
CRC32.C Smith/Sipe source code as modified by J. Eng
CRC32.H Smith/Sipe header file
UNZIP.DOC Notes about UNZIP from Smith
README Notes about UNZIP from Sipe
MacUnZip.c Source code for the Mac and to enhance portability
MacUnZip.h Header file for the Mac and to enhance portability
MacUnZip Application compiled with Lightspeed C v2.01
MacUnZip ReadMe This documentation file
----------------------
HOW TO USE THE PROGRAM
----------------------
MacUnZip is only one step in the process of converting a downloaded .ZIP file
into a file that can be used by a Macintosh application. Summarized below are
the rest of the steps. Because I am primarily interested in reading IBM text
and MIDI files, I will emphasize their unpacking in the steps below.
(1) Download the .ZIP file from a BBS using your communications program.
The communications software MUST NOT strip linefeeds while downloading the file.
(2) Run MacUnZip and specify the .ZIP filename. MacUnZip and the .ZIP
file must be in the same folder. The unpacked file(s) will also be placed in
the same folder.
(3) Use a resource editor (e.g., ResEdit by Apple Computer) or file
utility program (e.g., MacTools by Central Point Software, among many others) to
change the four-letter filetype from "TEXT" to "Midi" (note capitalization) if
the unpacked file is a standard MIDI file. This step is obviously not required
if the unpacked file is a text file in the first place. In that case, it should
be directly readable by most text editors and word processors.
(4) While doing step (3), the four-letter creatortype could also be
changed from "????" to that of an appropriate application on your system. For
example, use "MTPC" for Master Tracks Pro by Passport Designs; "ttxt" for
TeachText by Apple Computer; or "MSWD" for Microsoft Word. For other
applications, use the resource editor or file utility program from step (3) to
determine the four-letter creatortype for your particular application.
-------------------------
NOTES ON PORTING THE CODE
-------------------------
Although written with the intention of handling .ZIP files in non-IBM
environments, Samuel Smith's UNZIP is probably not generic enough for general
compilation. (See Sipe's notes for details.) George Sipe's modifications
significantly improved UNZIP's portability, but his use of UNIX libraries and
header files is still not quite generic enough.
All my modifications to UNZIP.C and CRC32.C are initialled "J.E." along with a
brief explanation. Nothing was deleted from my starting copy of UNZIP.C;
unnecessary lines were commented out (and initialled "J.E.") instead of deleted.
I minimized my modifications to the original code, even at the expense of not
providing a Macintosh-type user interface, in order to enhance portability.
Below is a summary of my modifications for the benefit of others interested in
porting this code:
(1) Addition of a header file, MacUnZip.h, to declare non-portable symbols
and functions found in UNZIP.C, as well as compiler flags and an initialization
routine for the Macintosh. MacUnZip.h also compensates for a memory restriction
of the Macintosh operating system and a memory allocation bug in Lightspeed C
v2.01. Functions declared in MacUnZip.h are defined in MacUnZip.c, which is
appended to UNZIP.C with an #include directive.
(2) Substitution of UNIX header files with their Lightspeed C equivalents.
UNIX header files are only informally "standard." I would suggest that any
further work with UNZIP.C rely only on the very basic symbols and functions
found in all C libraries.
(3) A bug was fixed by adding a size check while reading strings from the
.ZIP file. The program otherwise would crash if the number of characters to be
read was greater than STRSIZ.
(4) An initialization routine, MacInit(), is used to provide the main()
routine with UNIX-style command line arguments.
(5) The program was compiled with Lightspeed C v2.01 and requires the
MacTraps, stdio, unix, and strings libraries of Lightspeed C. UNZIP.C
#include's MacUnZip.h and MacUnZip.c; it also requires linking with CRC32.C.
----------
REFERENCES
----------
This work was made possible by a number of files downloaded from GEnie. They
are briefly reviewed and credited below.
File GEnie Service Library File Description
UNZIP201.ARC IBMPC 15607 Original IBM source code for UNZIP
by Smith/Sipe
ARC/MID HELP MAC 20312 A VERY helpful file explaining
how to unpack .ARC files and
general advice about downloading
and unpacking IBM files on the
Mac (by William Koehler)
ARCHIVES.TXT IBMPC 16122 A detailed explanation of the
various IBM and Mac file archive
formats (by Raymond Clay)
ResEdit MACPRO -- The latest version can be found
here
------------
A FINAL NOTE
------------
Although MacUnZip has not been extensively tested, it seems to work pretty well
so far. MacUnZip, like the original UNZIP, contains several unpacking
algorithms. I have only unpacked files using the "un-implode" algorithm, which
is the one most commonly used.
If you find MacUnZip or its documentation useful, please send me a message via
GEnie Mail (address: J.ENG). I would be glad to take bug reports via GEnie Mail
and work on the bug within a few days. I would then send a reply to the bug
reporter and upload the fixed version. Definitely let me know of your successes
in porting the code to other systems. Thanks.
--John Eng (GEnie Mail: J.ENG)